package com.hellobike.haxing.modules.product.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hellobike.haxing.modules.product.entity.District;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Description: 区县
 * @Author: haxing-boot
 * @Date:   2020-02-03
 * @Version: V1.0
 */
public interface DistrictMapper extends BaseMapper<District> {

    @Select("SELECT id, name, province_id, city_id FROM t_district WHERE city_id=#{cityId} AND EXISTS (SELECT 1 FROM t_shop WHERE district_id=t_district.id AND deleted=0)")
    List<District> getOpenedDistrictsByCityId(@Param("cityId") Long cityId);

    List<District> getOpenedDistrictsByCityIds(@Param("cityIdList") List<Long> cityIdList);
}
